package com.shz.controller;


import com.shz.pojo.Apply;
import com.shz.pojo.GoApply;
import com.shz.service.ApplyService;
import com.shz.service.GoApplyService;
import com.shz.service.UserService;
import com.shz.utils.DateUtils;
import com.shz.utils.UserUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author shz
 * @since 2024-09-03
 */
@Api(tags = "入驻申请模块")
@RestController
@RequestMapping("/go-apply")
public class GoApplyController {
    @Resource
    GoApplyService applyService;
    @Resource
    UserService userService;
    @ApiOperation(value = "入驻信息申请")
    @PostMapping("/save")

    public boolean addGoApply(@RequestBody GoApply apply) {
        apply.setCreateTime(DateUtils.getNowDate());
        apply.setUid(UserUtil.getCurrentUser().getId());
        apply.setStatus(false);
        String username = userService.query().eq("id", apply.getUid()).one().getUsername();
        apply.setUsername(username);
        return applyService.save(apply);
    }
}

